﻿Type.registerNamespace('ExtJSExtender.Controls');

/*
    ExtJSEventArgs定义：分别将事件名和事件参数序列化，在服务器端反序列化后使用
        var arguments = new Object();
        arguments.NodeSelected = this.encodeNode(node);
        arguments.MenuClicked = this.encodeNode(item);
        ExtJSExtender.Util.serializeEventArgs("ContextMenuClicked", arguments)
*/
ExtJSExtender.Controls.Util = function () {
    ExtJSExtender.Controls.Util.initializeBase(this);
}
ExtJSExtender.Controls.Util.prototype = {
    serializeEventArgs: function (eventName, arguments) {
        return Ext.encode(
                {
                    EventName: eventName,
                    Arguments: Ext.encode(arguments)
                });
    },
    getFn: function (functionName) {
        var fn = null;
        try {
            fn = window[functionName];
            if (typeof (fn) != 'function')
                fn = this.getEmptyFn();
        }
        catch (e) {
            fn = this.getEmptyFn();
        }
        return fn;
    },
    getEmptyFn: function () {
        return Function.emptyFunction;
    }
}
ExtJSExtender.Controls.Util.registerClass('ExtJSExtender.Controls.Util');
ExtJSExtender.Util = new ExtJSExtender.Controls.Util();

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();